package kr.hkit.powerjava.chapter12.interfaceex;

public class Box implements Comparable {
	private double volume;

	public Box(double volume) {
		this.volume = volume;
	}

	@Override
	public int compareTo(Object other) {

		return (int) (this.volume - ((Box) other).volume);
	}

	public static void main(String[] args) {
		Box b1 = new Box(100);
		Box b2 = new Box(185.0);

		if (b1.compareTo(b2) > 0) {
			System.out.println("b1 이큼");

		} else if (b1.compareTo(b2) < 0) {
			System.out.println("배가고픔");
		} else {
			System.out.println("b1 과 b2가 같음");
		}

	}

}
